#pragma once
#include <iostream>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
using namespace std;
class inetaddr
{

public:
  inetaddr(const sockaddr_in &addr) : _addr(addr)
  {

    _port = ntohs(_addr.sin_port);
    _ip = inet_ntoa(_addr.sin_addr);
  }

  string ip() { return _ip; }
  uint16_t port() { return _port; }
  ~inetaddr() {}

private:
  sockaddr_in _addr;
  string _ip;
  uint16_t _port;
};